﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControls_ReceiveGood : UCBase 
{
    public UserControls_ReceiveGood()
    {
        Name = "收货通知";
    }

    protected void Page_Load(object sender, EventArgs e)
    { 
        if (_Customer == null)
        {
            Response.Redirect("Default.aspx?PN=Login");
        }
        else
        {
            LoadData();
        }
     }

    private void LoadData()
    {
        long ShopID =_Site.ID;
        this.Page1.FindType = 0;
        this.Page1.Field1 = "";
        this.Page1.Field2 = "";
        this.Page1.Like1 = "";
        this.Page1.Like2 = "";
        Page1.GridID = gvOrder;
        Page1.TableName = "V_Shop_GetSalesMasterBySalesID";
        
        Page1.Condition = "where CustomerID=" + _Customer.ID + " and ShopID=" + _Site.ID + " and Status=3";
    }

    protected void gvOrder_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //设置表格样式
        e.Row.Attributes.Add("class", "black12");
        if (e.Row.RowType == DataControlRowType.Header)
        {
            e.Row.Style.Add("background-image", "url(images/bg_hui_23_2.jpg)");
        }
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.BackColor = System.Drawing.Color.FromName("#FFFFFF");
           
            LinkButton button = (LinkButton)e.Row.Cells[5].Controls[0];

            if (button.Text == "收货")
            {
                button.Attributes.Add("onclick", "return confirm('确定此操作吗？')");
            }
        }
    }

    /// <summary>
    /// 收货
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gvOrder_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        //BLL.sales_MasterBLL.UpdateSalesMaster(Shove._Convert.StrToLong(gvOrder.DataKeys[e.RowIndex].Value.ToString(), 0));
        Response.Redirect("Default.aspx?PN=member_home&Type=ReceiveGood.ascx");
    }
}
